package ac.neec.timewatch;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by G011C1093 on 14/01/22.
 */
public abstract class TimeWatchSubject {

    private List<TimeWatchInterface> observers =
            new ArrayList<TimeWatchInterface>();

    public void addObservers(TimeWatchInterface timerWatchInterface) {
        observers.add(timerWatchInterface);
    }

    public void removeObserver(TimeWatchInterface restingMeasurementInterface) {
        observers.remove(restingMeasurementInterface);
    }

    public void notifyTimerUpdata(long time){
        for (int i = 0; i < observers.size(); i++) {
            (observers.get(i)).notifyTimerUpdata(time);
        }
    }

    public void notifyCancelObservers() {
    	for( TimeWatchInterface i : observers){
    	}
        for (int i = 0; i < observers.size(); i++) {
            (observers.get(i)).onCancel();
        }
    }

    public void notifyAlarmObservers(){
       	for( TimeWatchInterface i : observers){
    	}
        for (int i = 0; i < observers.size(); i++) {
            (observers.get(i)).onAlarm();
        }
    }

}
